cmake_minimum_required(VERSION 3.5)
project(flashros_camera)

set(CMAKE_CXX_STANDARD 11)

option(ENABLE_TEST "Whether to add camera subscriber to test images in target topic" ON)

# add ros components
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  image_transport
  roscpp
  sensor_msgs
  flashros_commons # 自定义模块
)

# add opencv
find_package(OpenCV 4 REQUIRED)
include_directories(
  ${OpenCV_INCLUDE_DIRS}
)

catkin_package()
include_directories(
  ${catkin_INCLUDE_DIRS}
)

# camera publish node
add_executable(single_camera_publisher src/single_camera_publisher.cc)
target_link_libraries(single_camera_publisher ${catkin_LIBRARIES} ${OpenCV_LIBS} inih)
add_executable(two_stream_publisher src/two_stream_publisher.cc)
target_link_libraries(two_stream_publisher ${catkin_LIBRARIES} ${OpenCV_LIBS} inih)

# camera subscribe node
if (ENABLE_TEST)
add_executable(single_camera_subscriber src/single_camera_subscriber.cc)
target_link_libraries(single_camera_subscriber ${catkin_LIBRARIES} ${OpenCV_LIBS} inih)
add_executable(two_stream_subscriber src/two_stream_subscriber.cc)
target_link_libraries(two_stream_subscriber ${catkin_LIBRARIES} ${OpenCV_LIBS} inih)
endif()